# This scipt can change a block in a file.
import my_function2 as my
import os
import re
# block_head is a word without = and {
with open(r'ck3/game_path.txt', 'r', encoding='utf-8') as file:
    game_path = file.read()  # 读取全部内容到一个字符串

folder_path = game_path + r"/game/common/culture/traditions"
for root, dirs, files in os.walk(folder_path):
    for filename in files:
        file_path = os.path.join(root, filename)
        with open(file_path, 'r', encoding='utf-8') as file:
            content = file.read()
        regular_pattern = 'has_cultural_pillar ='
        new_pattern = '#has_cultural_pillar ='
        content = re.sub(regular_pattern, new_pattern, content)
        regular_pattern = 'geographical_region ='
        new_pattern = '#geographical_region ='
        content = re.sub(regular_pattern, new_pattern, content)
        with open(file_path, 'w', encoding='utf-8') as file:
            file.write(content)